<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<div class="span12 box-content">
	<form class="form-inline well" id="professionFilter_form">
		<div class="controls controls-row">
			<label>学院:</label>
			<select class="span2" style="display:inline;" name="college">
			  <option value='0' ${0==clgId?"selected='selected'":""}>不限</option>
			  <c:forEach items="${colleges }" var="c">
			 	 <option value="${c.id }" ${c.id==clgId?"selected='selected'":""}>${c.name }</option>
			  </c:forEach>
			</select>
			<label>系:</label>
			<select class="span2" style="display:inline;" name="department">
			  <option value='0' ${0==depId?"selected='selected'":""}>不限</option>
			  <c:forEach items="${departments }" var="d">
			 	 <option value="${d.id }" ${d.id==depId?"selected='selected'":""}>${d.name }</option>
			  </c:forEach>
			</select>	
			<button type="button" id="professionFilter_go">筛选</button>
		</div>
	</form>
	<div class="span12">共有${professionCount}条数据,${totalPage }页</div>
	<table class="table table-striped table-bordered" id="profession_list_table">
		<thead>
		 <tr role="row">
		 	<th >专业编号</th>
		 	<th>专业名</th>
		 	<th>索引</th>
		 	<th>更多</th>
		 </tr>
		</thead>   
		<tbody>
		<c:forEach items="${profession }" var="p">
			<tr>
				<td>${p.no }</td>
				<td>${p.name }</td>
				<td>${p.department.college.name}>${p.department.name}</td>
				<td>
				<c:if test="${!user.superAdmin&&user.collegeId!=p.department.college.id }">
					<c:set var="editDisabled" value="disabled"/>
				</c:if>
					<button type="button" class="btn btn-info profession_edit" data-professionId="${p.id }" data-target="#profession_edit_box" data-toggle="modal" ${editDisabled }>
						<i class="icon-edit icon-white"></i>  
						编辑
					</button>
					<button type="button" class="btn btn-danger profession_delete"  data-target="#profession_delete_box" data-toggle="modal" data-professionId="${p.id }" ${editDisabled }>
						<i class="icon-trash icon-white"></i>  
						删除
					</button>
					<c:if test="${editDisabled!=null }">
						无权操作
					</c:if>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination  pagination-centered"
			data-totalPage="${totalPage }" 
			data-currentPage="${page }" 
			data-url="<%=basePath%>admin/profession/showProfessionList/${clgId }/${depId }/{page}"
			style="display:none">
	</div>
	<div class="well">
		<button type="button" class="btn btn-primary" id="profession_add"  data-target="#profession_add_box" data-toggle="modal" >
			<i class=" icon-plus icon-white"></i>  
			新建一个专业
		</button>
	</div>
</div>
<!-- 信息修改 开始 -->
<div class="modal hide fade" id="profession_edit_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>编辑</h3>
	</div>
	<div class="modal-body">
		<div  class="ajax_wait" style="text-align: center;"><img src="<%=basePath %>images/ajax-loader.gif" title="wait" /></div>
		<div id="profession_edit_box_alert_container" ></div><br/>
		<form class="form-horizontal" id="profession_edit_box_form" style="display: none;">
			<input name="profession_id"size="16" type="hidden">
			<div class="control-group">
				<label class="control-label">专业编号</label>
				<div class="controls">
					<input name="profession_no"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">专业名</label>
				<div class="controls">
					<input name="profession_name"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属学院</label>
				<div class="controls">
				<c:if test="${!user.superAdmin }">
					<c:set var="cglDisable" value="disabled"/>
				</c:if>
					<select  name="college"  ${cglDisable }>
						<c:forEach items="${colleges }" var="c" >
							<option value="${c.id }" >${c.name }</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属系</label>
				<div class="controls">
					<select  name="department">
					</select>
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="profession_edit_box_save">保存</a>
	</div>
</div>
<!-- 信息修改 结束 -->
<!-- 删除确认 开始-->
<div class="modal hide fade" id="profession_delete_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>删除专业</h3>
	</div>
	<div class="modal-body">
		<input type="hidden" name="professionId"/>
            确认删除?删除动作不可撤销!
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-danger" id="profession_delete_box_delete">删除</a>
	</div>
</div>
<!-- 删除确认 结束 -->
<!-- 添加专业 开始 -->
<div class="modal hide fade" id="profession_add_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>新建一个专业</h3>
	</div>
	<div class="modal-body">
		<div id="profession_add_box_alert_container" ></div><br/>
		<form class="form-horizontal" id="profession_add_box_form">
			<input name="profession_id"size="16" type="hidden">
			<div class="control-group">
				<label class="control-label">专业编号</label>
				<div class="controls">
					<input name="profession_no"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">专业名</label>
				<div class="controls">
					<input name="profession_name"size="16" type="text">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属学院</label>
				<div class="controls">
				<c:if test="${!user.superAdmin }">
					<c:set var="cglDisable" value="disabled"/>
				</c:if>
					<select  name="college"  ${cglDisable }>
						<c:forEach items="${colleges }" var="c" >
							<c:if test="${!user.superAdmin }">
								<option value="${c.id }"  ${user.collegeId==c.id?"selected":"" }>${c.name }</option>
							</c:if>
							<c:if test="${user.superAdmin }">
								<option value="${c.id }" >${c.name }</option>
							</c:if>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">所属系</label>
				<div class="controls">
					<select  name="department">
					</select>
				</div>
			</div>
		</form>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="profession_add_box_save">保存</a>
	</div>
</div>
<!-- 添加专业 结束 -->